
//
//  ZCDeatailsHeaderCell.m
//  zctx
//
//  Created by apple on 15/11/25.
//  Copyright © 2015年 sanliang. All rights reserved.
//

#import "ZCDeatailsHeaderCell.h"

@implementation ZCDeatailsHeaderCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier cellType:(ZCDeatailsHeaderCellType)type{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        if (type == ZCDeatailsHeaderCellTypeinfo) {
            [self addLabelTitle];
            [self addLabelInfo];
        } else if (type == ZCDeatailsHeaderCellTypecontent) {
            [self addLabelContents];
        } else if (type == ZCDeatailsHeaderCellTypestate) {
            [self addLabelTitle];
            [self addLableState];
        }else if (type ==ZCDeatailsHeaderCellTypedetails){
            [self addLabelTitle];
            [self addDetailsView];
        }
    }
    return self;
}

- (void)addLabelTitle {
    [self.contentView addSubview:self.labelTitle];
    [self.labelTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.centerY);
        make.height.equalTo(self.contentView.height);
        make.left.mas_equalTo(@(15));
    }];
}
- (void)addLabelInfo {
    [self.contentView addSubview:self.labelInfo];
    [self.labelInfo mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.centerY);
        make.height.equalTo(self.contentView.height);
        make.right.mas_equalTo(@(-15));
        make.left.equalTo(self.labelTitle.right).with.offset(10);
    }];
}

-(void)addLableState{
    [self.contentView addSubview:self.stateImgView];
    [self.stateImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.centerY);
        make.height.mas_equalTo(@(30));
        make.width.mas_equalTo(@(90));
        make.left.equalTo(self.labelTitle.right).with.offset(10);
    }];
}

-(void)addDetailsView{
    [self.contentView addSubview:self.detailsView];
    [self.detailsView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.centerY);
        make.height.mas_equalTo(@(21));
        make.width.mas_equalTo(@(70));
        make.right.equalTo(self.contentView.right).with.offset(-15);
    }];
}

- (void)addLabelContents {
    [self.contentView addSubview:self.labelcontent];
    [self.labelcontent mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.centerY);
        make.height.equalTo(self.contentView.height);
        make.left.mas_equalTo(@(15));
        make.right.mas_equalTo(@(-15));
    }];
}


#pragma mark - instance

- (UILabel *)labelTitle {
    if (!_labelTitle) {
        _labelTitle = [[UILabel alloc] init];
        _labelTitle.font = [UIFont systemFontOfSize:15];
        [_labelTitle setTextColor:[UIColor colorWithHexString:@"#666666"]];
    }
    return _labelTitle;
}

- (UILabel *)labelInfo {
    if (!_labelInfo) {
        _labelInfo = [[UILabel alloc] init];
        _labelInfo.font = [UIFont systemFontOfSize:15];
        _labelInfo.textAlignment = NSTextAlignmentLeft;
        [_labelInfo setTextColor:[UIColor colorWithHexString:@"000000"]];
    }
    return _labelInfo;
}



- (UIImageView *)stateImgView {
    if (!_stateImgView) {
        _stateImgView = [[UIImageView alloc] init];
    }
    return _stateImgView;
}

- (UILabel *)labelcontent {
    if (!_labelcontent) {
        _labelcontent = [[UILabel alloc] init];
        _labelcontent.font = [UIFont systemFontOfSize:14];
        _labelcontent.numberOfLines = 0;
        _labelcontent.text = @"";
        [_labelcontent setTextColor:[UIColor colorWithHexString:@"000000"]];
    }
    return _labelcontent;
}

-(ZCProjectdetailsBtnView *)detailsView{
    if (!_detailsView) {
        _detailsView = [[ZCProjectdetailsBtnView alloc]init];
    }
    return _detailsView;
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
